# -*- coding: utf-8 -*-
import sys
import re

from pythonDFCF import t55

reload(sys)
sys.setdefaultencoding('utf-8')
import requests
def wjd(url):
    content=requests.get(url).content
    a=content.replace('var quote_123=','')
    #print(a)
    p = re.compile(r'\,[0-9]{6}\,\W')
    for m in p.finditer(a):
        strcode=m.group()
        strcode=str(strcode)
        p2 = re.compile(r'[0-9]{6}')
        for m2 in p2.finditer(strcode):
            #股票代码
            gpcode=m2.group()
            # print(gpcode)
            strurl="http://quote.eastmoney.com/sh"+gpcode+".html"
            # print(strurl)
            try:
                t55.jd(strurl,gpcode)
            except Exception:
                pass
#wjd('http://nufm.dfcfw.com/EM_Finance2014NumericApplication/JS.aspx?type=CT&cmd=C.BK04781&sty=FCOIATA&sortType=C&sortRule=-1&page=1&pageSize=20&js=var%20quote_123%3d{rank:[(x)],pages:(pc)}&token=7bc05d0d4c3c22ef9fca8c2a912d779c&jsName=quote_123&_g=0.12136006316703574')